#include "carddisplaydock.h"
#include "ui_carddisplaydock.h"

#include "imageprovider.h"

CardDisplayDock *cardDisplayDockInstance = NULL;

CardDisplayDock &CardDisplayDock::instance()
{
    return *cardDisplayDockInstance;
}

CardDisplayDock::CardDisplayDock(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::CardDisplayDock)
{
    cardDisplayDockInstance = this;
    ui->setupUi(this);
}

CardDisplayDock::~CardDisplayDock()
{
    delete ui;
}

void CardDisplayDock::displayCard(QString multiverseId)
{
    ImageProvider::instance().requestImage(multiverseId, this, SLOT(pixmapReady(QPixmap)));
}

void CardDisplayDock::pixmapReady(QPixmap pixmap)
{
    ui->cardLabel->setPixmap(pixmap);
}
